//@author A0096509U
#pragma once
#ifndef STRINGPARSER_H_
#define STRINGPARSER_H_

#include "TaskItGlobal.h"

//This is the main String Parser class used to parse string for the strict
//commands which includes the open and closed square brackets. The information
//for the different fields will be stored and it can be retrieved later on.
class StringParser {
private:
	string _infoString[NUM_OF_INFO]; //There's 8 set of information that is entered by the user.

public:
	StringParser();
	
	//Clears the _infoString array.
	//Pre-Req: None.
	//Post-Req: Clears the _infoString array.
	void clearInfoString();
	//Main parsing function in String Parser. Splits the string according to the square brackets
	//and saved the information into _infoString. Throws an invalid request if the number of open
	//square brackets is not equal to the number of closed square brackets and when an open square 
	//bracket is not matched by a closed square bracket.
	//Pre-Req: String containing all information that is input but the user.
	//Post-Req: Splits the string into its individual components in _infoString.
	void splitString(string allInfo);
	//Generates the empty field string "-" for information which are not specified by user.
	//Pre-Req: splitString should already be done.
	//Post-Req: Fields which are empty will be changed to a "-" which represents an EMPTY FIELD
	//			in our programme.
	void generateEmptyField();
	//Given a list of information of a task, it appends the information together and to include
	//the square brackets in the input format. This function is used for the displaying of current
	//tasks when the user wants to edit a task.
	//Pre-Req: 6 information fields of a task.
	//Post-Req: Returns a string in the input format [activity][venue][time start][time end][category][date].
	string contentateFields(string activity, string venue, string timeStart, string timeEnd, string category, string date);

	//This is the getter function to get each of the string in _infoString.
	//Pre-Req: Index of the information required.
	//Post-Req: Returns string _infoString[index].
	string getInfoNumber(int index);
};

#endif

